import Storage from '../utils/Storage.js';

export function getLocalResources(name) {
    let lo = Storage.getSessionStorage('RESOURCES').get(name);
    if (lo) return lo;
    let mn = name.toLowerCase(),
        res = {
            models: require(`./models.${mn}.json`),
            contours: require(`./contours.${mn}.json`),
            paths: require(`./paths.${mn}.json`)
        };
    // let b = window.btoa(JSON.stringify(res));
    // console.log('---> ', b);
    // let a = window.atob(b);
    // console.log('===> ', JSON.parse(a));
    Storage.getSessionStorage('RESOURCES').set(name, res);
    return res;
}
